#ifndef _ANIMATION_H
#define _ANIMATION_H

#include <vector>

#include "AnimationFrame.h"

class TexturedEntity;

class Animation
{
public:
    Animation(TexturedEntity* entity);
    ~Animation(void);

    void addFrame(const AnimationFrame& frame);
    void update(float dT);
    std::vector<float> getTexCoord(const Dimension& texSize) const;

    bool hasAnimationFinished(void) const;
    void setLoop(const bool loop) { m_loop = loop; }

    bool getVerticalFlip(void) { return m_verticalFlip; }
    void setVerticalFlip(const bool verticalFlip) { m_verticalFlip = verticalFlip; }

protected:
    TexturedEntity* m_entity;
    std::vector<Vector3> m_positionInTexture;
    std::vector<Dimension> m_dimension;
    std::vector<float> m_frameTimeout;
    int m_currentFrame;
    float m_elapsedTime;
    bool m_animationFinished;
    bool m_loop;   
    bool m_verticalFlip;

private:
    virtual void onUpdate(float dT) {}

};

#endif
